home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 903 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: EU.net!sun4nl!xs4all!falstaff
  2. From: falstaff@xs4all.nl (Falstaff)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Macros in C (Disadvantages?)
  5. Date: 9 Jan 1996 23:04:45 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4cusad$1db@news.xs4all.nl>
  8. References: <4cjluh$gva@kernighan.cs.umass.edu> <821173834.5944@paget.demon.co.uk> <4cthcp$1c0@yarrow.wt.com.au>
  9. NNTP-Posting-Host: xs1.xs4all.nl
  10. X-Newsreader: NN version 6.5.0 #666 (NOV)
  11.  
  12. bvarley@yarrow.wt.com.au (bruce varley) writes:
  13.  
  14. >Here is an a example that illustrates the danger(s) of macros.....
  15.  
  16. >#define A   7
  17. >#define B   4+5
  18.  
  19. >C = A * B.   This will produce  33.  
  20.  
  21. And there is always the difficulty with
  22.  
  23. #define A 1
  24. .
  25. . some code
  26. .
  27. #define A A+1
  28. .
  29. . more code
  30. .
  31. #define A A+1
  32.  
  33. that is partly solved in ANSI C by enumerate types; and the fact that 
  34. macros can't define other macros.
  35.  
  36. Frank
  37. --
  38. "Life without a backbone is hardly worth consideration."
  39. ------------------------------------------------------------------------
  40. Frank A. Vorstenbosch        +31-(70)-355 5241        falstaff@xs4all.nl
  41.